import http from 'wechat-http'
http.baseURL='http://124.223.14.236:8060/home'
// 请求拦截器
http.intercept.request= (config) => {
  const hastoken = wx.getStorageSync('token')
  const defaultHeader = {}
  defaultHeader.Token = hastoken
  config.header = Object.assign({}, defaultHeader, config.header)
  return config
}
// 响应拦截器
http.intercept.response = (response) => {
  // console.log(response)
 if(response.data.errno===9997){
  wx.toast(response.data.errmsg)
 }
  return response.data
}

export default http
wx.http = http